/**
 * ...
 * @author Krzysztof Rozalski
 */

package hapi.physics;
import hapi.math.MathUtil;
using hapi.math.AngleFactoryMethods;

class PhysicsFactoryMethods {
	
	private static inline var KPH_TO_MPS = 0.2777777777777777777777777777777777777777777777778;
	private static inline var MPH_TO_MPS = 0.44704;
	
	public static inline function metersPerSecond(s:Float):Speed {
		return new Speed(s);
	}
	
	public static inline function kmPerHour(s:Float):Speed {
		return new Speed(s*KPH_TO_MPS);
	}
	
	public static inline function milesPerHour(s:Float):Speed {
		return new Speed(s*MPH_TO_MPS);
	}
	
	public static function grams(m:Float):Mass {
		return new Mass(m*0.001);
	}
	
	public static function kilos(m:Float):Mass {
		return new Mass(m);
	}
	
	public static function tons(m:Float):Mass {
		return new Mass(m*1000);
	}
	
	public static function millis(t:Int):Time {
		return new Time(t*0.001);
	}
	
	public static function seconds(t:Float):Time {
		return new Time(t);
	}
	
	public static function minutes(t:Float):Time {
		return new Time(t*60);
	}
	
	public static function hours(t:Float):Time {
		return new Time(t*3600);
	}
	
	public static function millisFromNow(t:Int):Time {
		return secondsFromNow(t * 0.001);
	}
	
	public static function secondsFromNow(t:Float):Time {
		return new Time(haxe.Timer.stamp() + t);
	}
	
	public static function minutesFromNow(t:Float):Time {
		return secondsFromNow(t * 60);
	}
	
	public static function hoursFromNow(t:Float):Time {
		return secondsFromNow(t * 3600);
	}
	
	public static inline function radiansPerSecond(theta:Float):AngularVelocity {
		return new AngularVelocity(theta);
	}
	
	public static inline function degreesPerSecond(theta:Float):AngularVelocity {
		return new AngularVelocity(MathUtil.degToRad(theta));
	}
}